import java.util.HashMap;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);

        int n = scanner.nextInt();

        //key为学生姓名，value为成绩
        HashMap<String, Integer> map = new HashMap<>();

        while (n > 0) {
            n--;
            int x = scanner.nextInt();
            switch (x) {
                case 1 :
                    String name1 = scanner.next();
                    int score = scanner.nextInt();
                    map.put(name1, score);
                    System.out.println("OK");
                    break;
                case 2 :
                    String name2 = scanner.next();
                    if (!map.containsKey(name2)) {
                        System.out.println("Not found");
                    } else {
                        System.out.println(map.get(name2));
                    }
                    break;
                case 3 :
                    String name3 = scanner.next();
                    if (!map.containsKey(name3)) {
                        System.out.println("Not found");
                    } else {
                        map.remove(name3);
                        System.out.println("Deleted successfully");
                    }
                    break;
                case 4 :
                    int size = map.size();
                    System.out.println(size);
                    break;
            }
        }
        scanner.close();
    }
}
